/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.fox.iebav.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author waldenilson
 */
@Entity
@Table(name = "disputas")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Disputas.findAll", query = "SELECT d FROM Disputas d")})
public class Disputas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @SequenceGenerator(name="seqdisputas",sequenceName="disputas_id_seq",allocationSize=1)
    @GeneratedValue(generator="seqdisputas",strategy=GenerationType.SEQUENCE)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "inicio")
    @Temporal(TemporalType.TIMESTAMP)
    private Date inicio;
    @Column(name = "tempo")
    private Integer tempo;
    @Column(name = "fim")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fim;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "disputa")
    private List<Lances> lancesList;
    @JoinColumn(name = "lote", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Lotes lote;

    public Disputas() {
    }

    public Disputas(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getInicio() {
        return inicio;
    }

    public void setInicio(Date inicio) {
        this.inicio = inicio;
    }

    public Integer getTempo() {
        return tempo;
    }

    public void setTempo(Integer tempo) {
        this.tempo = tempo;
    }

    public Date getFim() {
        return fim;
    }

    public void setFim(Date fim) {
        this.fim = fim;
    }

    @XmlTransient
    public List<Lances> getLancesList() {
        return lancesList;
    }

    public void setLancesList(List<Lances> lancesList) {
        this.lancesList = lancesList;
    }

    public Lotes getLote() {
        return lote;
    }

    public void setLote(Lotes lote) {
        this.lote = lote;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Disputas)) {
            return false;
        }
        Disputas other = (Disputas) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.fox.iebav.entity.Disputas[ id=" + id + " ]";
    }
    
}
